class Home {
  private _area: number;
  set area(num: number) {
    this._area = num;
  }

  get area(): number {
    console.log('正在获取面积');
    return this._area;
  }
}

let myHome: Home = new Home();
myHome.area = 30;
console.log(myHome.area);